<?php if (!defined("_INDEX")) { header("Location: /"); die;} ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>REBUKO - Панель администратора</title>
	<link href="/files/style/styles.css" rel="stylesheet" type="text/css" />
	<link href="/files/style/admin_styles.css" rel="stylesheet" type="text/css" />
	<link href="/files/js/chosen/chosen.css" rel="stylesheet" type="text/css" />
	<link href="/files/js/jquery.ui/css/ui-darkness/jquery-ui-1.8.16.custom.css" rel="stylesheet" type="text/css" />
	
	<script type="text/javascript" src="/files/js/jquery.js"></script>
	<script type="text/javascript" src="/files/js/jquery-fieldselection.js"></script>
	<script type="text/javascript" src="/files/js/admin.js"></script>
	<script type="text/javascript" src="/files/js/chosen/chosen.jquery.min.js"></script>
	<script type="text/javascript" src="/files/js/jquery.ui/js/jquery-ui-1.8.16.custom.min.js"></script>
</head>
<body>
	<div class='center'>
		<div class='admin_head'>
			<div class='logo'>
				<a href='/'><img src='/files/img/logo_big.png' border='0'  alt="REBUKO"/></a>
			</div>
			<h1>Админ-панель</h1><?php
            if ($user->isAdmin()) echo "<a href='/admin/logout'>Выйти</a>";
		?></div>
		<br />
		<hr style="border-color: gray; border-width: 1px 0 0 0; border-style: solid;" />
		<hr style="border-color: #cFcFcF;border-style: solid;border-width: 1px 0 0 0;" />
		<hr style="border-color: #dfdfdf;border-style: solid;border-width: 1px 0 0 0;" />
		<hr style="border-color: #eFeFeF;border-style: solid;border-width: 1px 0 0 0;" />
		<?php
		if ($user->isAdmin())
		{
			$cquestions = $db->getCell("select count(`id`) from `tip_questions`");
			$cmonitor = $db->getCell("select count(`id`) from `content_monitor`");
			$cerrors = $db->getCell("select count(`error_id`) from `errors`");
			?><div class='admin_menu'>
				<div class='menu_el'>
					<div class='menu_header'>Страхование
						<div class='admin_submenu'>
							<div>Страхование</div>
							<ul>
								<li><a href='/admin/companies'>Страховщики</a></li>
								<li><a href='/admin/amount'>Суммы</a></li>
								<li><a href='/admin/offices'>Доп. офисы</a></li>
								<li><a href='/admin/c_votes'>Отзывы</a></li>
								<li><a href='/admin/services'>Страховые услуги</a></li>
								<li><a href='/admin/reliability'>Классы страхования</a></li>
							</ul>
						</div>
					</div>
				</div>
				<div class='menu_el'>
					<div class='menu_header'>Брокеры
						<div class='admin_submenu'>
							<div>Брокеры</div>
							<ul>
								<li><a href='/admin/brokers'>Брокеры</a></li>
								<li><a href='/admin/b_votes'>Отзывы</a></li>
							</ul>
						</div>
					</div>
				</div>
				<div class='menu_el'>
					<div class='menu_header'>Советы
						<div class='admin_submenu'>
							<div>Советы</div>
							<ul>
								<li><a href='/admin/tips'>Статьи</a></li>
								<li><a href='/admin/sections'>Разделы</a></li>
								<li><a href='/admin/questions'>Вопросы<?php if ($cquestions) echo " <span style='font-weight: bold'>($cquestions)</span>"; ?></a></li>
							</ul>
						</div>
					</div>
				</div>
				<div class='menu_el'>
					<div class='menu_header'>Общее
						<div class='admin_submenu'>
							<div>Общее</div>
							<ul>
								<li><a href='/admin/city'>Города</a></li>
								<li><a href='/admin/news'>Новости</a></li>
								<li><a href='/admin/smiles'>Смайлы</a></li>
							</ul>
						</div>
					</div>
				</div>
				<div class='menu_el'>
					<div class='menu_header'>Сайт
						<div class='admin_submenu'>
							<div>Сайт</div>
							<ul>
								<li><a href='/admin/users'>Пользователи</a></li>
								<li><a href='/admin/banners'>Баннеры</a></li>
								<li><a href='/admin/partners'>Партнеры</a></li>
								<li><a href='/admin/monitor'>Мониторинг<?php if ($cmonitor) echo " <span style='font-weight: bold'>($cmonitor)</span>"; ?></a></li>
								<li><a href='/admin/errors'>Ошибки<?php if ($cerrors) echo " <span style='font-weight: bold'>($cerrors)</span>"; ?></a></li>
								<li><a href='/admin/settings'>Настройки сайта</a></li>
							</ul>
						</div>
					</div>
				</div>
				<div class='cities' style="float:right; width: 250px">
					<select class='cities_select'><?php
						$cities = $db->getTable("select `city_id`,`name` from `city` order by `name`");
						echo select_create($cities,"city_id","name",$current_admin_city['city_id']);
					?></select>
				</div>
			</div>
			
			<?php
		}
?>